import request from '@/utils/request'

export function getCategoryList(type, tenantId, name) {
  return request({
    url: '/ops/category/allTreeList',
    method: 'get',
    params: {type: type, tenantId: tenantId, name: name}
  })
}

export function addCategory(data) {
  return request({
    url: '/ops/category/add',
    method: 'post',
    data
  })
}

export function updateCategory(data) {
  return request({
    url: '/ops/category/update',
    method: 'post',
    data
  })
}

export function deleteCategory(params) {
  return request({
    url: '/ops/category/delete',
    method: 'get',
    params: {id: params}
  })
}

export function addMoreCourseCategory(data) {
  return request({
    url: '/ops/category/addMoreCourseCategory',
    method: 'post',
    data
  })
}

export function getVersionList(params) {
  return request({
    url: '/ops/releaseVersion/getReleaseVersionByTenantId',
    method: 'get',
    params: {tenantId: params}
  })
}

export function deleteVersion(params) {
  return request({
    url: '/ops/releaseVersion/delReleaseVersionById',
    method: 'get',
    params: {id: params}
  })
}

export function addVersion(data) {
  return request({
    url: '/ops/releaseVersion/addReleaseVersion',
    method: 'post',
    data
  })
}

export function updateVersion(data) {
  return request({
    url: '/ops/releaseVersion/update',
    method: 'post',
    data
  })
}

export function appointVersion(versionIds, categoryId) {
  return request({
    url: '/ops/releaseVersion/appoint',
    method: 'get',
    params: {versionIds: versionIds, categoryId: categoryId}
  })
}
